package mysocket

import (
	"os"
	"protection/mysocket/funcs"
	"protection/user/docs"
	"protection/user/method"
	"protection/user/router"

	myrpc "github.com/2217263633/kakarpc"

	"github.com/gin-gonic/gin"
)

func main() {
	var yaml myrpc.ServerStruct = myrpc.ServerStruct{
		Name: "UserService",
		Router: map[string]interface{}{
			"HandleWebSocket": []string{"token"},
			"PostMsg":         []string{"WsMessage"},
		},
		Mode:      myrpc.Debug,
		Port:      1235,
		Swag_port: 1236,
	}
	yaml.Path, _ = os.Getwd()

	// 连接注册中心
	// 让注册中心给自己分配一个端口

	docs.SwaggerInfo.BasePath = ""
	gin.SetMode(gin.ReleaseMode)
	funcs.Rpc.R = router.Router()
	funcs.Rpc.Conn = new(method.UserService)
	myrpc.MyRpc.GoRpc(&yaml, &funcs.Rpc)
}
